package com.wqiuqiu.gulimall.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;

import com.wqiuqiu.common.annotation.ListValue;
import com.wqiuqiu.common.annotation.NullButEmpty;
import com.wqiuqiu.common.validator.group.AddGroup;
import com.wqiuqiu.common.validator.group.UpdateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 * 
 * @author wqiuqiu
 * @email 18773489795@163.com
 * @date 2023-11-27 14:08:57
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@Null(groups = {AddGroup.class}, message = "新增不能指定id")
	@NotNull(groups = {UpdateGroup.class}, message = "修改必须指定id")
	@TableId
	private Long brandId;
	/**
	 * 品牌名
	 */
	@NullButEmpty(groups = {UpdateGroup.class})
	@NotBlank(groups = {AddGroup.class},message = "品牌名不能为空")
	private String name;
	/**
	 * 品牌logo地址
	 */
	@NotNull(message = "logo地址不能为空", groups = {AddGroup.class})
	@URL(message = "logo地址必须为合法网址", groups = {AddGroup.class,UpdateGroup.class})
	private String logo;
	/**
	 * 介绍
	 */
	@NotEmpty(message = "品牌描述不能为空", groups = {AddGroup.class})
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@ListValue(values = {0,1}, groups = {AddGroup.class,UpdateGroup.class})
	private Integer showStatus;
	/**
	 * 检索首字母
	 */
	@NotNull(message = "检索首字母不能为空",groups = {AddGroup.class})
	@Pattern(regexp = "^[a-zA-Z]$", message = "首字母必须为单个字母且是a-z或者A-Z其中一个", groups = {AddGroup.class,UpdateGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
	@NotNull
	@Min(value = 0, message = "排序字段必须大于等于0")
	private Integer sort;

}
